
<?php $__env->startSection('content'); ?>

    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">年卡</strong> /
                    <small>List</small>
                </div>
            </div>
            <?php echo $__env->make('admin._flash', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <hr>

            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                            <a href="/admin/member/create" type="button" class="am-btn am-btn-default"><span
                                        class="am-icon-plus"></span> 新增</a>


                        </div>
                    </div>
                </div>
            </div>
            <hr>




            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr style="font-size: 1.6rem">

                                <th class="table-id">ID</th>
                                <th class="table-id">名称</th>
                                <th class="table-id"style="width: 200px">描述</th>
                                <th class="table-type" style="width: 100px">价格</th>
                                <th class="table-id">是否启用</th>
                                <th class="table-type" style="width: 60px">月数</th>
                                <th class="table-type" style="width: 60px">排序</th>
                                <th class="table-id"style="width: 120px">可暂停次数</th>
                                <th class="table-id"style="width: 120px">暂停最大天数</th>
                                <th class="table-id"style="width: 120px">是否参加活动</th>
                                <th class="table-id"style="width: 100px" >活动价</th>


                                <th class="table-author">所属门店</th>
                                <th class="table-set">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k=> $i): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr data-id="<?php echo e($i->id); ?>" style="font-size: 1.6rem">

                                    <td><?php echo e($k+1); ?></td>
                                    <td>
                                        <label class="am-btn am-btn-default am-btn-xs am-radius" >
                                           <?php echo e($i->name); ?>

                                        </label>
                                    </td>

                                    <td> <?php echo e($i->about); ?></td>

                                    <td> <?php echo e($i->price); ?>元</td>

                                    <td>
                                        <?php if($i->is_use == 1): ?>
                                            <span class="am-icon-check is_use"></span>
                                        <?php endif; ?>
                                        <?php if($i->is_use == 0): ?>
                                            <span class="am-icon-close is_use"></span>
                                        <?php endif; ?>
                                    </td>

                                    <td>
                                        <label class="am-btn am-btn-default am-btn-xs am-radius" >
                                            <?php echo e($i->month); ?>月
                                        </label>


                                    </td>

                                    <td>
                                        <input type="text" class="stock sort_order" value="<?php echo e($i->sort); ?>" style="width: 60px">
                                    </td>

                                    <td>

                                        <label class="am-btn am-btn-default am-btn-xs am-radius" >
                                            <?php echo e($i->stop_time); ?>次
                                        </label>


                                    </td>
                                    <td>

                                        <label class="am-btn am-btn-default am-btn-xs am-radius" >
                                            <?php echo e($i->can_stop_maxday); ?>天
                                        </label>

                                    </td>

                                    <td>
                                        <?php if($i->is_active == 1): ?>
                                            <span class="am-icon-check is_active"></span>
                                        <?php endif; ?>
                                        <?php if($i->is_active == 0): ?>
                                            <span class="am-icon-close is_active"></span>
                                        <?php endif; ?>
                                    </td>

                                    <td>
                                        <?php echo e($i->active_price); ?>元
                                    </td>

                                    <td>

                                        <label class="am-btn am-btn-danger am-btn-xs am-radius" >
                                            <?php echo e($i['store']['name']); ?>

                                        </label>


                                    </td>

                                    <td>
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                <a href="/admin/member/<?php echo e($i->id); ?>/edit" class="am-btn am-btn-primary am-btn-xs"><span
                                                            class="am-icon-pencil-square-o"></span> 编辑
                                                </a>
                                                <a href="/admin/member/<?php echo e($i->id); ?>"
                                                   data-method="delete"
                                                   data-token="<?php echo e(csrf_token()); ?>" data-confirm="确认删除吗?"
                                                   class="am-btn am-btn-danger am-btn-xs del_one">
                                                    <span class="am-icon-trash-o"></span> 删除
                                                </a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                            </tbody>
                        </table>
                        

                        <div class="am-cf">
                            <div class="am-fr">
                                
                            </div>
                        </div>
                        <hr/>
                        <p>注：.....</p>
                    </form>
                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>


<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
    <script>
        $(function () {


            //ajax排列
            $('.sort_order').change(function () {
                var sort = $(this).val();
                var id = $(this).parents('tr').data('id');
//                console.log(id);return false;
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/member/sort',
                    data: {sort: sort, id: id},
                    success: function () {
                        location.href = "/admin/member"
                    }
                })
            })

            //改变是否使用
            $('.is_use').click(function () {
                //   alert(111);

                var id = $(this).parents('tr').data('id');
// console.log(id);exit;
                var _this = $(this);
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/member/is_use',
                    data: {id: id},
                    success: function () {
                        _this.toggleClass('am-icon-check am-icon-close');
                    }
                })

            })

            //改变是否参加活动
            $('.is_active').click(function () {
                //   alert(111);

                var id = $(this).parents('tr').data('id');
// console.log(id);exit;
                var _this = $(this);
                $.ajax({
                    type: 'PATCH',
                    url: '/admin/member/is_active',
                    data: {id: id},
                    success: function () {
                        _this.toggleClass('am-icon-check am-icon-close');
                    }
                })

            })







        })
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin.application', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>